package com.zl_huang.example.model;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name="exam_user")
public class User implements Serializable {
	
	private static final long serialVersionUID = 1L;
	@Id
	@Column(name = "user_id",length = 10 , nullable = false)
	private String user_id;
	@Column(name = "user_name",length = 45 , nullable = false)
	private String user_name;
	@Column(name = "password",length = 255 , nullable = false)
	private String password;
	@Column(name = "tel",length = 20)
	private String tel;
	@Column(name = "email",length = 255)
	private String email;
	@Column(name = "address",length = 255)
	private String address;
	@Column(name = "birthday",length = 255 , nullable = false)
	private String birthday;
	@Column(name = "gender",length = 255 , nullable = false)
    private String gender;
	@Column(name = "last_lock_time")
	private Date last_lock_time;
	@Column(name = "login_fail_count")
	private int login_fail_count;
	@OneToMany(mappedBy="user")
	private Set<ExamUserSubject> examUser;
	@OneToMany(mappedBy="roleUser")
	private Set<UserRole> userRole;	
	public User(){
		
	}
	public User(String user_id,String user_name,String password,String tel,String email, String address,String birthday,String gender,Date last_lock_time,int login_fail_count){
		this.user_id = user_id;
		this.user_name = user_name;
		this.password = password;
		this.tel = tel;
		this.email = email;
		this.address = address;
		this.birthday = birthday;
		this.gender = gender;
		this.last_lock_time = last_lock_time;
		this.login_fail_count = login_fail_count;	
	}
	
	public String getUser_id() {
		return user_id;
	}
	public void setUser_id(String user_id) {
		this.user_id = user_id;
	}
	public String getUser_name() {
		return user_name;
	}
	public void setUser_name(String user_name) {
		this.user_name = user_name;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getTel() {
		return tel;
	}
	public void setTel(String tel) {
		this.tel = tel;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getBirthday() {
		return birthday;
	}
	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}
	public String getGender() {
		if(gender != null && gender.equals("1")){
			return "女";
		}else{
			return "男";
		}
	}
	public void setGender(String gender) {
		this.gender = gender;
	}
	
	public Date getLast_lock_time() {
		return last_lock_time;
	}
	public void setLast_lock_time(Date last_lock_time) {
		this.last_lock_time = last_lock_time;
	}
	public int getLogin_fail_count() {
		return login_fail_count;
	}
	public void setLogin_fail_count(int login_fail_count) {
		this.login_fail_count = login_fail_count;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
}
